function username_check() {
    //获取用户名文本框的内容
    var uname = username.value;
    //判断用户名是否为空
    if (!uname) {
        //若为空,将后面span标签赋值
        span_name.innerHTML = "用户名不能为空"
        //利用jquery修改span标签中文字颜色
        $(document).ready(function () {
            $("#span_name").css("color", "red")
        })
        return false;
    } else if (uname.length > 10) {
        span_name.innerHTML = "用户名太长";
        $(document).ready(function () {
            $("#span_name").css("color", "red")
        })
        return false;
    } else if (uname.length < 5) {
        span_name.innerHTML = "用户名太短";
        $(document).ready(function () {
            $("#span_name").css("color", "red")
        })
        return false;
    }
    //正则表达式
    var valid = /^\w+$/;
    if (!valid.test(uname)) {
        span_name.innerHTML = "用户名必须是数字、字母或下划线"
        $(document).ready(function () {
            $("#span_name").css("color", "red")
        })
        return false;
    }
}


function password_check() {
    var upwd_upwd = password.value;
    if (!upwd_upwd) {
        span_password.innerHTML = "密码为空";
        $(document).ready(function () {
            $("#span_password").css("color", "red")
        })
        return false;
    } else if (upwd_upwd.length > 10) {
        span_password.innerHTML = "密码太长";
        $(document).ready(function () {
            $("#span_password").css("color", "red")
        })
        return false;
    } else if (upwd_upwd.length < 6) {
        span_password.innerHTML = "密码太短"
        $(document).ready(function () {
            $("#span_password").css("color", "red")
        })
        return false;
    }
}